{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 1a. Calculate Pvsat for a single melt composition from a dataframe using default options" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Python set-up\n", "You need to install VolFe once on your machine, if you haven't yet. Then we need to import a few Python packages (including VolFe). " ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Install VolFe on your machine.\n", "# pip install VolFe # Remove the first # in this line if you have not installed VolFe on your machine before.\n", "\n", "# import python packages\n", "import pandas as pd\n", "import VolFe as vf" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Define the inputs\n", "\n", "At a minimum to run a Pvsat calculations, we need a dataframe of the melt composition, an estimate of oxygen fugacity and Fe in the melt [note 1], and temperature:\n", "\n", "- Sample is just the name for this analysis.\n", "\n", "- Temperature is in °C.\n", "\n", "- Volatile-free melt composition is in wt% oxides [note 2]. All these oxides must be present in the dataframe, so set them to 0. if you have no data for them (although see [note 1] around FeOT).\n", "\n", "- H2O is all hydrogen in the melt reported as H2O in wt% [note 3]. \n", "\n", "- CO2ppm is all carbon in the melt reported as CO2 in ppm [note 3].\n", "\n", "- STppm is all sulfur in the melt reported as S in ppm [note 3].\n", "\n", "- Xppm is all \"X\" in the melt reported as \"X\" in ppm [note 3]. \"X\" is an unreactive melt species whose identity can be changed - this is explored in Example 1d.\n", "\n", "- Fe3+FeT is the ratio of Fe3+ to FeT in the melt.\n", "\n", "[note 1] In this example we specify oxygen fugacity using Fe3+/FeT and Fe in the melt as FeOT as is quite common for melt inclusion and matrix glass analyses - other options are possible, shown later in the notebook.\n", "\n", "[note 2] It does not matter what the non-volatile oxides sum too - they are renormalised to 100 wt% minus the total of the volatiles (i.e., H2O + CO2 + ST + X).\n", "\n", "[note 3] The volatile concentrations are absolute for the melt = i.e., the non-volatile melt composition is normalised to 100 wt% minus the volatiles. The volatiles are not added to the oxides and then renormalised.\n", "\n", "The following composition is analysis TN273-01D-01-01 from Brounce et al. (2014) with the updated Fe3+/FeT from Cottrell et al. (2021), with a temperature chosen as 1200 °C." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Sample T_C SiO2 TiO2 Al2O3 FeOT MnO MgO CaO Na2O \\\n", "0 TN273-01D-01-01 1200.0 56.98 1.66 15.52 9.47 0.24 2.96 6.49 4.06 \n", "\n", " K2O P2O5 H2O CO2ppm STppm Fe3FeT \n", "0 0.38 0.22 1.88 13.0 362.83 0.155 \n" ] } ], "source": [ "# Define the melt composition, fO2 estimate, and T as a dictionary.\n", "my_analysis = {'Sample':'TN273-01D-01-01',\n", " 'T_C': 1200., # Temperature in 'C\n", " 'SiO2': 56.98, # wt%\n", " 'TiO2': 1.66, # wt%\n", " 'Al2O3': 15.52, # wt%\n", " 'FeOT': 9.47, # wt%\n", " 'MnO': 0.24, # wt%\n", " 'MgO': 2.96, # wt%\n", " 'CaO': 6.49, # wt%\n", " 'Na2O': 4.06, # wt%\n", " 'K2O': 0.38, # wt%\n", " 'P2O5': 0.22, # wt%\n", " 'H2O': 1.88, # wt%\n", " 'CO2ppm': 13., # ppm\n", " 'STppm': 362.83, # ppm\n", " 'Fe3FeT': 0.155} # mole or weight fraction (they're the same)\n", "\n", "# Turn the dictionary into a pandas dataframe, setting the index to 0.\n", "my_analysis = pd.DataFrame(my_analysis, index=[0])\n", "\n", "# Show the DataFrame.\n", "print(my_analysis)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For this example we will use the default options in VolFe, which can be found below:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " option\n", "type \n", "COH_species yes_H2_CO_CH4_melt\n", "H2S_m True\n", "species X Ar\n", "Hspeciation none\n", "fO2 Kress91A\n", "... ...\n", "error 0.1\n", "print status False\n", "output csv True\n", "setup False\n", "high precision False\n", "\n", "[78 rows x 1 columns]\n" ] } ], "source": [ "# print default options in VolFe\n", "print(vf.default_models)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Run the calculation\n", "\n", "### Define fO2 using Fe3+/FeT\n", "\n", "And below runs the calculation - it outputs a dataframe of the full results." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | sample | \n", "T_C | \n", "P_bar | \n", "SiO2_wtpc | \n", "TiO2_wtpc | \n", "Al2O3_wtpc | \n", "FeOT_wtpc | \n", "MnO_wtpc | \n", "MgO_wtpc | \n", "CaO_wtpc | \n", "... | \n", "KHOSg opt | \n", "KOSg opt | \n", "KOSg2 opt | \n", "KCOg opt | \n", "KCOHg opt | \n", "KOCSg opt | \n", "KCOs opt | \n", "carbonylsulfide opt | \n", "density opt | \n", "Date | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "TN273-01D-01-01 | \n", "1200.0 | \n", "328.128601 | \n", "57.03956 | \n", "1.661735 | \n", "15.536223 | \n", "9.479899 | \n", "0.240251 | \n", "2.963094 | \n", "6.496784 | \n", "... | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "ONeill22 | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "Moussallam19 | \n", "Holloway92 | \n", "COS | \n", "DensityX | \n", "2025-03-07 16:37:48.271042 | \n", "
1 rows × 173 columns
\n", "| \n", " | sample | \n", "T_C | \n", "P_bar | \n", "SiO2_wtpc | \n", "TiO2_wtpc | \n", "Al2O3_wtpc | \n", "FeOT_wtpc | \n", "MnO_wtpc | \n", "MgO_wtpc | \n", "CaO_wtpc | \n", "... | \n", "KHOSg opt | \n", "KOSg opt | \n", "KOSg2 opt | \n", "KCOg opt | \n", "KCOHg opt | \n", "KOCSg opt | \n", "KCOs opt | \n", "carbonylsulfide opt | \n", "density opt | \n", "Date | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "TN273-01D-01-01 | \n", "1200.0 | \n", "322.471098 | \n", "57.597308 | \n", "1.677984 | \n", "15.68814 | \n", "8.61352 | \n", "0.2426 | \n", "2.992068 | \n", "6.560311 | \n", "... | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "ONeill22 | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "Moussallam19 | \n", "Holloway92 | \n", "COS | \n", "DensityX | \n", "2025-02-18 13:16:18.593337 | \n", "
1 rows × 173 columns
\n", "| \n", " | sample | \n", "T_C | \n", "P_bar | \n", "SiO2_wtpc | \n", "TiO2_wtpc | \n", "Al2O3_wtpc | \n", "FeOT_wtpc | \n", "MnO_wtpc | \n", "MgO_wtpc | \n", "CaO_wtpc | \n", "... | \n", "KHOSg opt | \n", "KOSg opt | \n", "KOSg2 opt | \n", "KCOg opt | \n", "KCOHg opt | \n", "KOCSg opt | \n", "KCOs opt | \n", "carbonylsulfide opt | \n", "density opt | \n", "Date | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "TN273-01D-01-01 | \n", "1200.0 | \n", "401.474722 | \n", "52.288592 | \n", "1.523325 | \n", "14.242172 | \n", "16.859825 | \n", "0.22024 | \n", "2.716291 | \n", "5.95565 | \n", "... | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "ONeill22 | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "Moussallam19 | \n", "Holloway92 | \n", "COS | \n", "DensityX | \n", "2025-02-18 13:16:19.183230 | \n", "
1 rows × 173 columns
\n", "| \n", " | sample | \n", "T_C | \n", "P_bar | \n", "SiO2_wtpc | \n", "TiO2_wtpc | \n", "Al2O3_wtpc | \n", "FeOT_wtpc | \n", "MnO_wtpc | \n", "MgO_wtpc | \n", "CaO_wtpc | \n", "... | \n", "KHOSg opt | \n", "KOSg opt | \n", "KOSg2 opt | \n", "KCOg opt | \n", "KCOHg opt | \n", "KOCSg opt | \n", "KCOs opt | \n", "carbonylsulfide opt | \n", "density opt | \n", "Date | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "TN273-01D-01-01 | \n", "1200.0 | \n", "437.868827 | \n", "57.03956 | \n", "1.661735 | \n", "15.536223 | \n", "9.479899 | \n", "0.240251 | \n", "2.963094 | \n", "6.496784 | \n", "... | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "ONeill22 | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "Moussallam19 | \n", "Holloway92 | \n", "COS | \n", "DensityX | \n", "2025-02-18 13:16:19.868705 | \n", "
1 rows × 173 columns
\n", "| \n", " | sample | \n", "T_C | \n", "P_bar | \n", "SiO2_wtpc | \n", "TiO2_wtpc | \n", "Al2O3_wtpc | \n", "FeOT_wtpc | \n", "MnO_wtpc | \n", "MgO_wtpc | \n", "CaO_wtpc | \n", "... | \n", "KHOSg opt | \n", "KOSg opt | \n", "KOSg2 opt | \n", "KCOg opt | \n", "KCOHg opt | \n", "KOCSg opt | \n", "KCOs opt | \n", "carbonylsulfide opt | \n", "density opt | \n", "Date | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "TN273-01D-01-01 | \n", "1200.0 | \n", "390.067172 | \n", "57.03956 | \n", "1.661735 | \n", "15.536223 | \n", "9.479899 | \n", "0.240251 | \n", "2.963094 | \n", "6.496784 | \n", "... | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "ONeill22 | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "Moussallam19 | \n", "Holloway92 | \n", "COS | \n", "DensityX | \n", "2025-02-18 13:16:21.882443 | \n", "
1 rows × 173 columns
\n", "| \n", " | sample | \n", "T_C | \n", "P_bar | \n", "SiO2_wtpc | \n", "TiO2_wtpc | \n", "Al2O3_wtpc | \n", "FeOT_wtpc | \n", "MnO_wtpc | \n", "MgO_wtpc | \n", "CaO_wtpc | \n", "... | \n", "KHOSg opt | \n", "KOSg opt | \n", "KOSg2 opt | \n", "KCOg opt | \n", "KCOHg opt | \n", "KOCSg opt | \n", "KCOs opt | \n", "carbonylsulfide opt | \n", "density opt | \n", "Date | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "TN273-01D-01-01 | \n", "1200.0 | \n", "327.89713 | \n", "57.03956 | \n", "1.661735 | \n", "15.536223 | \n", "9.479899 | \n", "0.240251 | \n", "2.963094 | \n", "6.496784 | \n", "... | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "ONeill22 | \n", "Ohmoto97 | \n", "Ohmoto97 | \n", "Moussallam19 | \n", "Holloway92 | \n", "COS | \n", "DensityX | \n", "2025-02-18 13:16:22.574874 | \n", "
1 rows × 173 columns
\n", "